﻿using Logic;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Common;

namespace AppAdmin.Controllers
{
    public class ModuleController : BaseController
    {

        //[HttpGet]
        //public ActionResult GetTreeSelectJson()
        //{

        //    var data = new ModuleLogic().GetList();
        //    var treeList = new List<TreeSelectModel>();
        //    foreach (Sys_Module item in data)
        //    {
        //        TreeSelectModel treeModel = new TreeSelectModel();
        //        treeModel.id = item.F_Id;
        //        treeModel.text = item.F_FullName;
        //        treeModel.parentId = item.F_ParentId;
        //        treeList.Add(treeModel);
        //    }
        //    return Content(treeList.TreeSelectJson());
        //}
        //[HttpGet]
        //public ActionResult GetTreeGridJson(string keyword)
        //{
        //    var data = new ModuleLogic().GetList();
        //    if (!string.IsNullOrEmpty(keyword))
        //    {
        //        data = data.TreeWhere(t => t.F_FullName.Contains(keyword));
        //    }
        //    var treeList = new List<TreeGridModel>();
        //    foreach (Sys_Module item in data)
        //    {
        //        TreeGridModel treeModel = new TreeGridModel();
        //        bool hasChildren = data.Count(t => t.F_ParentId == item.F_Id) == 0 ? false : true;
        //        treeModel.id = item.F_Id;
        //        treeModel.isLeaf = hasChildren;
        //        treeModel.parentId = item.F_ParentId;
        //        treeModel.expanded = hasChildren;
        //        treeModel.entityJson = item.ToJson();
        //        treeList.Add(treeModel);
        //    }
        //    return Content(treeList.TreeGridJson());
        //}
        //[HttpGet]
        //public ActionResult GetFormJson(string keyValue)
        //{
        //    var data = new ModuleLogic().GetForm(keyValue);
        //    return Content(data.ToJson());
        //}
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult SubmitForm(Sys_Module moduleEntity, string keyValue)
        //{
        //    new ModuleLogic().SubmitForm(moduleEntity, keyValue);
        //    return Content(new AjaxResult { state = ResultType.success.ToString(), message = "操作成功。" }.ToJson());
        //}
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult DeleteForm(string keyValue)
        //{
        //    new ModuleLogic().DeleteForm(keyValue);
        //    return Content(new AjaxResult { state = ResultType.success.ToString(), message = "删除成功。" }.ToJson());
        //}
    }
}
